﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Model.WXshopBuiness;
namespace Xproject.Util
{
    public class Cache_Product
    {
        public static string CACHE_KEY_PRODUCT_ALL = "CACHE_KEY_PRODUCT_ALL";
        public static string CACHE_KEY_PRODUCT_TUIJIAN= "CACHE_KEY_PRODUCT_TUIJIAN";

        public static List<WXProduct> WXProduct
        {
            get
            {
                return System.Web.HttpRuntime.Cache[CACHE_KEY_PRODUCT_ALL] as List<WXProduct>;

            }
            set
            {
                System.Web.HttpRuntime.Cache.Insert(CACHE_KEY_PRODUCT_ALL, value, null, DateTime.Now.AddDays(1), System.Web.Caching.Cache.NoSlidingExpiration);
            }
        }
       
        public static List<WXProduct> WXProductTuiJian {
            get
            {
                return System.Web.HttpRuntime.Cache[CACHE_KEY_PRODUCT_TUIJIAN] as List<WXProduct>;

            }
            set
            {
                System.Web.HttpRuntime.Cache.Insert(CACHE_KEY_PRODUCT_TUIJIAN, value, null, DateTime.Now.AddDays(1), System.Web.Caching.Cache.NoSlidingExpiration);
            }
        }
        /// <summary>
        /// 清理推荐的产品缓存
        /// </summary>
        public static void ClearWXProductTuiJian()
        {
            System.Web.HttpRuntime.Cache.Remove(CACHE_KEY_PRODUCT_TUIJIAN);
        }
        /// <summary>
        /// 清理所有的产品缓存
        /// </summary>
        public static void ClearWXProduct()
        {
            System.Web.HttpRuntime.Cache.Remove(CACHE_KEY_PRODUCT_ALL);
        }
    }
}
